﻿#include "hotelplatformserver.h"
#include <QApplication>
#include "connectsqilte.h" //ConnectSQilte
#include "connectmysql.h" //ConnectMySQL
#include <QMessageBox>

#if _MSC_VER >= 1600
#pragma execution_character_set("utf-8")
#endif

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    ConnectMySQL mysql;
    QMessageBox::StandardButton result;
    bool isConnected = mysql.createConnection();
    HotelPlatformServer w;
    w.show();

    if (!isConnected)
    {
        result = QMessageBox::warning(&w,
                             "Do you want to exit?",
                             "The MySql can't connect",
                             QMessageBox::Yes | QMessageBox::Cancel,
                             QMessageBox::Yes);

        if (result == QMessageBox::Yes)
        {
            mysql.closeConnection();
            return -1;
        }
    }
    int res = a.exec();

    mysql.closeConnection();
    return res;
}
